<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var balance = 100;
        do {
            var n = prompt(
                `请输入对应的编号执行相应的操作:
 1.存钱
 2.取钱
 3.查看余额
 4退出`) - 0;
            switch (n) {
                case 1:
                    var money = prompt('请输入存入金额') - 0;
                    balance += money;
                    alert(`操作成功,您的余额为:${balance}元`)
                    break;
                case 2:
                    money = prompt('请输入取出金额') - 0;
                    while (money > balance) {
                        alert(`余额不足,您的余额为${balance},请重新输入`)
                        money = prompt('请输入取出金额') - 0;
                    }
                    balance -= money;
                    alert(`操作成功,您的余额为:${balance}元`)
                    break;
                case 3:
                    alert(`您的余额为:${balance}元`)
                    break;
                case 4:
                    alert('正在退出,请稍候')
                    break;
                default:
                    alert('输入有误,请重新输入')
                    break;
            }
        } while (n !== 4)
    </script>
</head>

<body>

</body>

</html>